package com.gluck.cases.core.modal.assemble;

import com.gluck.cases.core.modal.dto.CasesRecordDTO;
import com.gluck.cases.core.modal.entity.CasesRecord;

import java.util.Date;

/**
 * @ClassName CasesRecordAssemble
 * @Desc CasesRecord 组装类
 * @Author shiyongzhe
 * @Date 2022/6/2 - 9:54 下午
 **/
public class CasesRecordAssemble {

    public static CasesRecord CasesRecordDTOConvertCasesGroup(CasesRecordDTO dto){
        CasesRecord casesRecord = new CasesRecord();
        casesRecord.setCreatedAt(new Date());
        casesRecord.setCaseId(dto.getCaseId());
        casesRecord.setResult(dto.getResult());
        casesRecord.setIsSuccess(dto.getIsSuccess());
        casesRecord.setUserId(dto.getUserId());
        return casesRecord;
    }

    public static CasesRecordDTO CasesRecordConvertCasesGroupDTO(CasesRecord record){
        CasesRecordDTO dto = new CasesRecordDTO();
        dto.setCaseId(record.getCaseId());
        dto.setUserId(record.getUserId());
        dto.setIsSuccess(record.getIsSuccess());
        dto.setResult(record.getResult());
        dto.setId(record.getId());
        return dto;
    }
}
